#ifndef BUILDING_H
#define BUILDING_H

#include "AReVi/arObject.h"
using namespace AReVi;

#include "element.h"

class Building : public Element {
public:
  AR_CLASS(Building)
  AR_CONSTRUCTOR(Building)

  virtual
  bool
  setSize(double sx, double sy, double sz);

  virtual
  void
  getSize(double & sx, double & sy, double & sz);

  virtual
  bool
  setFacadeHeight(double fh);

  virtual
  double
  getFacadeHeight(void);

  virtual
  bool
  setSideWalkGeometry(double width, double heigth);

  virtual
  void
  getSideWalkGeometry(double & width, double & heigth);


  /** 3D Representation handling */
  inline virtual ArRef<Object3D> getRepresentation(void) const { return _representation; }

  /** Initialise element. Must be done after calling constructor.
    *  Can be used to differenciate local and distant elements */
  virtual void init();

protected:
  /** Write Element configuration to stream */
  virtual void writeConfiguration(ArRef<AbstractOStream> oStream);
  /** Read Element configuration to stream */
  virtual void readConfiguration(ArRef<AbstractIStream> iStream);

  /** Write Element configuration to stream */
  virtual void writeUpdate(ArRef<AbstractOStream> oStream);
  /** Read Element configuration to stream */
  virtual void readUpdate(ArRef<AbstractIStream> iStream);


  ArRef<Object3D> _representation;

  void
  _computeSideWalk(void);

  void
  _computeBuilding(void);

//   void
//   _rebuildIfNeeded(void);

  ArRef<Mesh3D> _sideWalk;
  ArRef<Mesh3D> _facade;
  ArRef<Mesh3D> _windows;
  ArRef<Mesh3D> _roof;

  double _sx,_sy,_sz;

  double _fh;

  double _swHeigth, _swWidth;

};

#endif
